package com.liusha.quicksand.web;

import com.liusha.quicksand.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 一世长安一世欢
 * @Date: 2020/11/8
 * @Time: 21:56
 * @Description: No Description
 */

@Controller
public class AttController {

    @Autowired
    private BlogService blogService;

    @GetMapping("/act")
    public String att(@PageableDefault(size = 30, sort = {"updatetime"}, direction = Sort.Direction.DESC) Pageable pageable, Model model,
                      HttpServletRequest request) {
        model.addAttribute("recommendBlogs", blogService.listRecommendBlogTop(60));
        return "act";
    }
}
